<template>
  <div class="shop-info">
    <div class="shop-top">
      <img src="~assets/img/common/placeholder.png" alt="">
      <span class="title">{{ shop.name }}</span>
    </div>

    <div class="shop-middle">
      <div class="shop-middle-left">
        <div class="shop-middle-l1">
          <!--<div class="sells-count">{{ shop.sells }}</div>-->
          <div class="sells-count">{{ shop.sells | sellCountFilter }}</div>
          <div>总销量</div>
        </div>
        <div class="shop-middle-l2">
          <div class="goods-count">{{ shop.goodsCount }}</div>
          <div>全部宝贝</div>
        </div>
      </div>
      <div class="shop-middle-right">
        <table>
          <tr v-for="(item, index) in shop.score" class="right-table-tr">
            <td>{{ item.name }}</td>
            <td class="score" :class="{score2: item.isBetter}">{{ item.score }}</td>
            <td class="more" :class="{more2: item.isBetter}">{{ item.isBetter? '高':'低' }}</td>
          </tr>
        </table>
      </div>
    </div>

    <div class="shop-btn">
      <button>进店逛逛</button>
    </div>
  </div>
</template>

<script>
  export default {
    name: "",
    props: {
      shop: {
        type: Object,
        default(){
          return {}
        }
      }
    },
    filters: {
      sellCountFilter(value){
        let result = value;
        if(value > 10000){//判断销量是否大于1万
          result = (result / 10000).toFixed(1) + '万';
        }
        return result;
      }
    }
  }
</script>

<style lang="less" scoped>
  .shop-info{
    padding: 20px 10px;
    border-bottom: 3px solid #eee;
  }
  .shop-top{

  }
  .shop-top img{
    display: inline-block;
    height: 38px;
    width: 38px;
    border-radius: 50%;
    border: 1px solid #cccccc;
    vertical-align: middle;
  }
  .shop-top span{
    color: black;
    padding-left: 8px;
    font-size: 18px;
  }
  .shop-middle{
    height: 120px;
    display: flex;
  }
  .shop-middle > div{
    width: 50%;
  }
  .shop-middle-left{
    height: 50px;
    display: flex;
    justify-content: space-around;
    margin-top: 35px;
    border-right: 1px solid #cccccc;
  }
  .shop-middle-right{
    padding: 32px 0 0 16px;
    font-size: 15px;
  }
  .right-table-tr:first-child{
    transform: translateY(-6px);
  }
  .right-table-tr:last-child{
    transform: translateY(6px);
  }
  .shop-middle-left > div{
    height: 100%;
    text-align: center;
  }
  .sells-count,.goods-count{
    font-size: 18px;
    padding: 4px 0;
  }

  .shop-btn{
    text-align: center;
    /*padding: 12px 0 0 0;*/
  }
  .shop-btn button{
    padding: 8px;
    width: 140px;
    border: 0;
    font-size: 15px;
    background-color: #eeeeee;
    outline: none;
    border-radius: 10px;
  }
  .score{
    color: mediumseagreen;
    font-weight: bold;
    padding: 0 4px;
  }
  .more{
    color: whitesmoke;
    background-color: mediumseagreen;
  }
  .score2{
    color: var(--color-high-text);
  }
  .more2{
    color: whitesmoke;
    background-color: var(--color-tint);
  }
</style>
